<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<jsp:include page="common/header.jsp">
    <jsp:param name="title" value="国际要闻 - 天天新闻网"/>
</jsp:include>

<!-- 页面主体内容 -->
<main class="container mt-4">
    <div class="guoji">
        <img src="images/19.png" alt="" class="main-image"/>
        <div class="row">
            <!-- 左侧新闻列表 -->
            <div class="col-md-8 guoji_left">
                <div class="guoji_left_tittle">最新</div>
                <div class="guoji_left_list">
                    <ul class="list-unstyled">
                        <c:forEach items="${newsList}" var="news">
                            <li>
                                <span>
                                    <a href="newsDetail?id=${news.new_id}" class="text-decoration-none text-dark">
                                        ${news.title}
                                    </a>
                                </span>
<%--                                <p>${news.content}</p>--%>
                                <c:set var="newsContent" value="${news.content}" />
                                <c:choose>
                                    <c:when test="${fn:length(newsContent) > 200}">
                                        <p>${fn:substring(newsContent, 0, 200)}...</p>
                                    </c:when>
                                    <c:otherwise>
                                        <p>${newsContent}</p>
                                    </c:otherwise>
                                </c:choose>
                            </li>
                        </c:forEach>
                    </ul>
                </div>
            </div>

            <!-- 右侧热点新闻 -->
            <div class="col-md-4 guoji_right">
                <span>热点</span>
                <c:forEach items="${hotNews}" var="news">
                    <div class="hot-news-item">
                        <img src="images/${news.img_url}" alt="" class="img-fluid w-100"/>
                        <p>
                            <a href="newsDetail?id=${news.new_id}" class="text-decoration-none text-dark">
                                ${news.title}
                            </a>
                        </p>
                    </div>
                </c:forEach>
            </div>
        </div>
    </div>
</main>

<jsp:include page="common/footer.jsp"/> 